extends BaseEntity
class_name Knight2

var idleImg = preload("res://assets/player/Idle (1).png");

var run1Img = preload("res://assets/player/Run (1).png");
var run2Img = preload("res://assets/player/Run (2).png");
var run3Img = preload("res://assets/player/Run (3).png");
var run4Img = preload("res://assets/player/Run (4).png");
var run5Img = preload("res://assets/player/Run (5).png");
var run6Img = preload("res://assets/player/Run (6).png");
var run7Img = preload("res://assets/player/Run (7).png");
var run8Img = preload("res://assets/player/Run (8).png");
var run9Img = preload("res://assets/player/Run (9).png");
var run10Img = preload("res://assets/player/Run (10).png");

var imgIndex: float = 0;

func _init():
	self.position = Vector2(self.x,self.y);

	self.texture = idleImg;

	self.xv = 10;
	self.yv = 10;

func _process(_delta):
	var imgArray = [
		run1Img,run2Img,run3Img,
		run4Img,run5Img,run6Img,
		run7Img,run8Img,run9Img,
		run10Img
	];

	if(floor(imgIndex) == imgArray.size() - 1):
		imgIndex = 0
	else:
		imgIndex = imgIndex + 0.33;

	self.texture = imgArray[floor(imgIndex)];
